package com.ztstkj.lzservices.utils

import android.util.Base64
import java.io.File
import java.io.FileInputStream

object FileUtil {
    //@RequiresApi(Build.VERSION_CODES.O)
    fun imageBase64(path: String): String {
        if (!File(path).exists()) return ""
        FileInputStream(path).use {
            val bytes = it.readBytes()
            //val mimeType=Files.probeContentType(Paths.get(path))
            return  "data:image/jpeg;base64,"+ Base64.encodeToString(bytes, Base64.DEFAULT)
        }
    }
    fun delete(path: String): Boolean{
        if(File(path).exists()){
            return  File(path).delete()
        }
        return false
    }


}